<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>">
		<title>insert title</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">    
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
			<link rel="stylesheet" type="text/css" href="styles.css">
		-->
		<link rel="stylesheet" type="text/css" href="<%=basePath %>scripts/static/h-ui/css/H-ui.min.css" />
		<link rel="stylesheet" type="text/css" href="<%=basePath %>scripts/static/h-ui.admin/css/H-ui.admin.css" />
		<link rel="stylesheet" type="text/css" href="<%=basePath %>scripts/lib/Hui-iconfont/1.0.7/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="<%=basePath %>scripts/lib/icheck/icheck.css" />
		<link rel="stylesheet" type="text/css" href="<%=basePath %>scripts/static/h-ui.admin/skin/default/skin.css" id="skin" />
		<link rel="stylesheet" type="text/css" href="<%=basePath %>scripts/static/h-ui.admin/css/style.css" />
		<script type="text/javascript" src="<%=basePath %>scripts/jquery-1.9.1.js"></script>
		<script type="text/javascript" src="<%=basePath %>scripts/lib/layer/2.1/layer.js"></script>
		<script type="text/javascript">
			/*关闭layer窗口*/
			function layer_close(){
				window.parent.layer.closeAll();
			}
			function pwd_change(){
				var mno = $("#mno").val();
				var pwd1 = $("#pwd1").val();
				var pwd2 = $("#pwd2").val();
				if(pwd1 =="" || pwd2 ==""){
					layer.msg("密码不能为空");
				}else if(pwd1!=pwd2){
					layer.msg("两次输入密码不一致");
				}else{
					var jsonUrl = "<%=basePath%>manager/updatePwd/"+mno;
					var inputData = {"mpassword":pwd1};
					$.ajax({
						url:jsonUrl,
						type:'post',
						dataType:'text',
						data:inputData,
						success:function(data){
							layer.msg("成功修改密码，请重新登录");
							setTimeout(function(){
								window.parent.location.href="<%=basePath%>logout";
							}, 500);
						}
					});
				}
			}
		</script>
	</head>
	<body>
		<div class="page-container">
			<input type="hidden" id="mno" value="${managers.mno }"/>
			<form class="form form-horizontal">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>新密码：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="password" class="input-text" id="pwd1">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>确认密码：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="password" class="input-text" id="pwd2">
					</div>
				</div>
				
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
						<button onClick="pwd_change()" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 修改密码</button>
						<button onClick="layer_close()" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
					</div>
				</div>
			</form>
		</div>
	</body>
</html>